# Maintainer: Christian Hesse <mail@eworm.de>

pkgname=yubikey-personalization-gui
pkgver=3.1.25
pkgrel=2
pkgdesc='Yubico YubiKey Personalization GUI'
arch=('loong64' 'x86_64')
url='https://github.com/Yubico/yubikey-personalization-gui'
license=('BSD')
depends=('yubikey-personalization' 'qt5-base' 'libxkbcommon-x11')
makedepends=('imagemagick')
provides=('yubikey-personalization-tool')
conflicts=('yubikey-personalization-tool')
validpgpkeys=('0A3B0262BCA1705307D5FF06BCA00FD4B2168C0A') # Klas Lindfors <klas@yubico.com>
source=("https://developers.yubico.com/${pkgname}/Releases/${pkgname}-${pkgver}.tar.gz"{,.sig})
sha256sums=('680b8ba8251c828847ffddd520165ac14927c2c6ee4ae39cfa9022ad7dd9dece'
            'SKIP')

build() {
	cd "${pkgname}-${pkgver}"

	qmake-qt5 "CONFIG += debian"
	make
}

check() {
	cd "${pkgname}-${pkgver}"

	make check
}

package() {
	cd "${pkgname}-${pkgver}"

	install -D -m0755 build/release/yubikey-personalization-gui "${pkgdir}/usr/bin/yubikey-personalization-gui"
	install -D -m0644 resources/lin/yubikey-personalization-gui.1 "${pkgdir}/usr/share/man/man1/yubikey-personalization-gui.1"

	install -D -m0644 resources/lin/yubikey-personalization-gui.desktop "${pkgdir}/usr/share/applications/yubikey-personalization-gui.desktop"

	install -D -m0644 resources/lin/yubikey-personalization-gui.png "${pkgdir}/usr/share/icons/hicolor/128x128/apps/yubikey-personalization-gui.png"
	for SIZE in 16 24 32 48 64 96; do
                # set modify/create for reproducible builds
                convert -scale ${SIZE} +set date:create +set date:modify \
			resources/lin/yubikey-personalization-gui.png \
			"${srcdir}"/yubikey-personalization-gui.png
		install -D -m0644 "${srcdir}"/yubikey-personalization-gui.png "${pkgdir}/usr/share/icons/hicolor/${SIZE}x${SIZE}/apps/yubikey-personalization-gui.png"
	done

	install -D -m0644 COPYING "${pkgdir}/usr/share/licenses/yubikey-personalization-gui/COPYING"
	install -D -m0644 README "${pkgdir}/usr/share/doc/yubikey-personalization-gui/README"
}

